<%@page import="com.sinba.common.system.dto.RuleDTO"%>
<%@page import="com.sinba.common.system.service.IRuleService"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>规则设置</title>
<%
ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
IRuleService ruleService = (IRuleService)ac.getBean("ruleService");
RuleDTO ruleDTO = ruleService.findRuleInfo();
request.setAttribute("ruleDTO",ruleDTO);

String level1 = "一星";
String level2 = "二星";
String level3 = "三星";
String level4 = "四星";
String level5 = "五星";
String level6 = "六星";
%>
<script type="text/javascript">

function saveRule(){
	var _frm = $('#ruleSetForm').serialize();
	$.post('rule!editRule.action',_frm,function(){
		alert('保存成功!');
	});
	
}
function upload(locimage,fileInputId,returnShowId){
	var FileType = "jpg,png,gif"; 
    var FileName = locimage.value;
    FileName = FileName.substring(FileName.lastIndexOf('.')+1, FileName.length).toLowerCase(); 
    if (FileType.indexOf(FileName) == -1)
     {
    	$('#'+fileInputId).val("");
    	alert('请选择jpg,png,gif格式文件!');
     }else{
    	 uploadopt(FileName,fileInputId,returnShowId,"");
     }
}
function uploadopt(FileName,fileInputId,returnShowId,value){
	var imageFileNametoreuqest=new Date().getTime()+"."+FileName;
	var url='fileUpload!fileUpload.action?path=banner&imageFileNametoreuqest='+imageFileNametoreuqest;
	$.ajaxFileUpload({
		url:url,
		secureuri:false,
        fileElementId:fileInputId,
        dataType:'String',
		success: function (data){
			alert('上传成功!');
			$('#'+fileInputId).val("");
			//$('#'+returnShowId).text("upload/"+imageFileNametoreuqest);
		},
		error: function (data, status){
			alert('上传失败!');
        }
	});
}

</script>
<style type="text/css">
.rulevalue input {
	width: 50px;
}
.settingTitle {
	font-weight: 600;
	background-color: #B7D9FA;
	color: blue;	
}

</style>
</head>
<body>

<div style="padding: 10px;width: 98%;">
	<form id="ruleSetForm">
		<input type="hidden" name="ruleDTO.ruleId" value="${ruleDTO.ruleId }" />
		<fieldset>
			<legend><h3>平台设置</h3></legend>
			<table style="width: 98%;">
				<tr>
					<td>平台名称</td>
					<td>
					<input type="text" style="width: 95%;" name="ruleDTO.rule002" value="${ruleDTO.rule002}" /></td>
				</tr>
				<tr>
					<td>版权信息</td>
					<td>
					<input type="text" style="width: 95%;" name="ruleDTO.rule009" value="${ruleDTO.rule009}" /></td>
				</tr>
				<tr>
					<td>平台关闭</td>
					<td>
						打开：<input type="radio" name="ruleDTO.rule021" value="false" checked="checked" />
						&nbsp;&nbsp;&nbsp;
						关闭：<input type="radio" name="ruleDTO.rule021" value="true" <c:if test="${ruleDTO.rule021 }">checked="checked"</c:if>  />
					</td>
				</tr>
				<tr>
					<td>平台关闭提示</td>
					<td><textarea rows="2" style="width: 95%;" name="ruleDTO.rule001">${ruleDTO.rule001}</textarea> </td>
				</tr>
				<tr>
					<td>引导页图片</td>
					<td>
						<input type="file" id="rule_upload_file" onchange="upload(this,'rule_upload_file','')" name="myFile"/>
					</td>
				</tr>
				<!--  
				<tr>
					<td>提现手续费-理财宝B</td>
					<td><input type="text" name="ruleDTO.rule014" value="${ruleDTO.rule014 }" />%</td>
				</tr>-->
				<tr>
					<td>大盘状态</td>
					<td>
						<select name="ruleDTO.marketStatus">
							<option <c:if test="${ruleDTO.marketStatus eq 'Open'}">selected="selected"</c:if> value="Open">开市</option>
							<option <c:if test="${ruleDTO.marketStatus eq 'Limit'}">selected="selected"</c:if> value="Limit">涨停</option>
							<option <c:if test="${ruleDTO.marketStatus eq 'Rest'}">selected="selected"</c:if> value="Rest">休市</option>
						</select>
						
						<input name="ruleDTO.closingPrice" value="${ruleDTO.closingPrice}" readonly="readonly" />
					</td>
				</tr>
				<tr>
					<td>拆分次数</td>
					<td>
						<input name="ruleDTO.rule038" value="${ruleDTO.rule038}" readonly="readonly" />
					</td>
				</tr>
				<tr>
					<td>大盘总股数</td>
					<td>
						<input name="ruleDTO.rule020" value="<fmt:formatNumber value="${ruleDTO.rule020}" pattern="#0"/>"  />
					</td>
				</tr>
				<tr>
					<td colspan="2"><input type="button" onclick="saveRule()" value=" 保存 " /></td>
				</tr>
			</table>
		</fieldset>
		<fieldset>
			<legend><h3>制度设置</h3></legend>
			<div>
				<%=level1 %>:<%=ruleDTO.level.get("L1") %>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<%=level2 %>:<%=ruleDTO.level.get("L2") %>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<%=level3 %>:<%=ruleDTO.level.get("L3") %>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<%=level4 %>:<%=ruleDTO.level.get("L4") %>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<%=level5 %>:<%=ruleDTO.level.get("L5") %>
			</div>
			
			<table style="width: 100%;">
				<tr>
					<td colspan="2" class="settingTitle">日分红</td>
				</tr>
				<tr>
					<td colspan="2">
						<table style="width: 100%;text-align: left;" class="rulevalue">
							<tr>
								<th>每日分红:<input type="text" name="ruleDTO.yifenghong1" value="${ ruleDTO.yifenghong1 }" />%<th>
							</tr>
							<%-- <tr>
								<th>日分红出局:<input type="text" name="ruleDTO.yifenghong2" value="${ ruleDTO.yifenghong2 }" />倍(静动态)</th>
							</tr> --%>
						</table>
					</td>
				</tr>
				<tr>
					<td colspan="2" class="settingTitle">直推奖</td>
				</tr>
				<tr>
					<td colspan="2">
						<table style="width: 100%;text-align: left;" class="rulevalue">
							<tr>
								<th width="100px;">直推奖:<th>
								<td><%=level1 %>:<input type="text" name="ruleDTO.zhitui1" value="${ ruleDTO.zhitui1 }" />%</td>
								<td><%=level2 %>:<input type="text" name="ruleDTO.zhitui2" value="${ ruleDTO.zhitui2 }" />%</td>
								<td><%=level3 %>:<input type="text" name="ruleDTO.zhitui3" value="${ ruleDTO.zhitui3 }" />%</td>
								<td><%=level4 %>:<input type="text" name="ruleDTO.zhitui4" value="${ ruleDTO.zhitui4 }" />%</td>
								<td><%=level5 %>:<input type="text" name="ruleDTO.zhitui5" value="${ ruleDTO.zhitui5 }" />%</td>
							</tr>
						</table>
					</td>
				</tr> 
				<tr>
					<td colspan="2" class="settingTitle">对碰奖</td>
				</tr>
				
				<tr>
					<td colspan="2">
						<table style="width: 100%;text-align: left;" class="rulevalue">
							<tr>
								<th width="100px;">对碰奖率</th>
								<td><%=level1 %>:<input type="text" name="ruleDTO.duipeng1" value="${ ruleDTO.duipeng1 }" />%</td>
								<td><%=level2 %>:<input type="text" name="ruleDTO.duipeng2" value="${ ruleDTO.duipeng2 }" />%</td>
								<td><%=level3 %>:<input type="text" name="ruleDTO.duipeng3" value="${ ruleDTO.duipeng3 }" />%</td>
								<td><%=level4 %>:<input type="text" name="ruleDTO.duipeng4" value="${ ruleDTO.duipeng4 }" />%</td>
								<td><%=level5 %>:<input type="text" name="ruleDTO.duipeng5" value="${ ruleDTO.duipeng5 }" />%</td>
								<%-- <td><%=level6 %>:<input type="text" name="ruleDTO.duipeng6" value="${ ruleDTO.duipeng6 }" />%</td> --%>
							</tr>
						    <tr>
								<th width="100px;">对碰奖封顶</th>
								<td><%=level1 %>:<input type="text" name="ruleDTO.duipeng7" value="${ ruleDTO.duipeng7 }" /></td>
								<td><%=level2 %>:<input type="text" name="ruleDTO.duipeng8" value="${ ruleDTO.duipeng8 }" /></td>
								<td><%=level3 %>:<input type="text" name="ruleDTO.duipeng9" value="${ ruleDTO.duipeng9 }" /></td>
								<td><%=level4 %>:<input type="text" name="ruleDTO.duipeng10" value="${ ruleDTO.duipeng10 }" /></td>
								<td><%=level5 %>:<input type="text" name="ruleDTO.duipeng11" value="${ ruleDTO.duipeng11 }" /></td>
								<%-- <td><%=level6 %>:<input type="text" name="ruleDTO.duipeng12" value="${ ruleDTO.duipeng12 }" /></td> --%>
							</tr> 
							<%-- <tr>
								<th>对碰奖提升</th>
								<td colspan="6">
									<textarea style="height: 30px;width: 95%;" name="ruleDTO.duipeng13" >${ ruleDTO.duipeng13 }</textarea>
								</td>
							</tr> --%>
						</table>
					</td>
				</tr>			
				
				<tr>
					<td colspan="2" class="settingTitle">见点奖</td>
				</tr>
				<tr>
					<td colspan="2">
						<table style="width: 100%;text-align: left;" class="rulevalue">
							
							<tr>
								<th width="100px;">层数</th>
								<td><%=level1 %>:<input type="text" name="ruleDTO.fuwu1" value="${ ruleDTO.fuwu1 }" />%</td>
								<td><%=level2 %>:<input type="text" name="ruleDTO.fuwu2" value="${ ruleDTO.fuwu2 }" />%</td>
								<td><%=level3 %>:<input type="text" name="ruleDTO.fuwu3" value="${ ruleDTO.fuwu3 }" />%</td>
								<td><%=level4 %>:<input type="text" name="ruleDTO.fuwu4" value="${ ruleDTO.fuwu4 }" />%</td>
								<td><%=level5 %>:<input type="text" name="ruleDTO.fuwu5" value="${ ruleDTO.fuwu5 }" />%</td>
								<%-- <td><%=level6 %>:<input type="text" name="ruleDTO.fuwu6" value="${ ruleDTO.fuwu6 }" />%</td> --%>
							</tr>
							<tr>
								<th width="100px;">比例(%):</th>
								<td><%=level1 %>:<input type="text" name="ruleDTO.fuwu7" value="${ ruleDTO.fuwu7 }" /></td>
								<td><%=level2 %>:<input type="text" name="ruleDTO.fuwu8" value="${ ruleDTO.fuwu8 }" /></td>
								<td><%=level3 %>:<input type="text" name="ruleDTO.fuwu9" value="${ ruleDTO.fuwu9 }" /></td>
								<td><%=level4 %>:<input type="text" name="ruleDTO.fuwu10" value="${ ruleDTO.fuwu10 }" /></td>
								<td><%=level5 %>:<input type="text" name="ruleDTO.fuwu11" value="${ ruleDTO.fuwu11 }" /></td>
								<%-- <td><%=level6 %>:<input type="text" name="ruleDTO.fuwu12" value="${ ruleDTO.fuwu12 }" /></td> --%>
							</tr>
						</table>
					</td>
				</tr>
				
				<tr>
					<td colspan="2" class="settingTitle">领导奖</td>
				</tr>
				<tr>
					<td colspan="2">
						<table style="width: 100%;text-align: left;" class="rulevalue">
							<tr>
								<th width="100px;">代数</th>
								<td><%=level1 %>:<input type="text" name="ruleDTO.daishu1" value="${ ruleDTO.daishu1 }" /></td>
								<td><%=level2 %>:<input type="text" name="ruleDTO.daishu2" value="${ ruleDTO.daishu2 }" /></td>
								<td><%=level3 %>:<input type="text" name="ruleDTO.daishu3" value="${ ruleDTO.daishu3 }" /></td>
								<td><%=level4 %>:<input type="text" name="ruleDTO.daishu4" value="${ ruleDTO.daishu4 }" /></td>
								<td><%=level5 %>:<input type="text" name="ruleDTO.daishu5" value="${ ruleDTO.daishu5 }" /></td>
								<%-- <td><%=level6 %>:<input type="text" name="ruleDTO.daishu6" value="${ ruleDTO.daishu6 }" /></td> --%>
							</tr>	
							<tr>
								<th width="100px;">比例(%)</th>
								<td><%=level1 %>:<input type="text" name="ruleDTO.daishu7" value="${ ruleDTO.daishu7 }" />%</td>
								<td><%=level2 %>:<input type="text" name="ruleDTO.daishu8" value="${ ruleDTO.daishu8 }" />%</td>
								<td><%=level3 %>:<input type="text" name="ruleDTO.daishu9" value="${ ruleDTO.daishu9 }" />%</td>
								<td><%=level4 %>:<input type="text" name="ruleDTO.daishu10" value="${ ruleDTO.daishu10 }" />%</td>
								<td><%=level5 %>:<input type="text" name="ruleDTO.daishu11" value="${ ruleDTO.daishu11 }" /></td>
								<%-- <td><%=level6 %>:<input type="text" name="ruleDTO.daishu12" value="${ ruleDTO.daishu12 }" />%</td> --%>
								
							</tr>
							
						</table>
					</td>
				</tr>
				
				<%--
				<tr>
					<td colspan="2" class="settingTitle">出局标准</td>
				</tr>
				<tr>
					<td colspan="2">
						<table style="width: 100%;text-align: center;" class="rulevalue">
							<tr>
								<th>出局标准(倍)</th>
								<td>无推荐:<input type="text" name="ruleDTO.rule031" value="${ ruleDTO.rule031 }" />倍</td>
								<td>直推1单:<input type="text" name="ruleDTO.rule032" value="${ ruleDTO.rule032 }" />倍</td>
								<td>推荐5单:<input type="text" name="ruleDTO.rule033" value="${ ruleDTO.rule033 }" />倍</td>
								<td>推荐10单:<input type="text" name="ruleDTO.rule034" value="${ ruleDTO.rule034 }" />倍</td>
								<td>推荐15单:<input type="text" name="ruleDTO.rule035" value="${ ruleDTO.rule035 }" />倍</td>
								<td></td>
								<td></td>
							</tr>
						</table>
						
					</td>
				</tr>
				--%>
				<%-- <tr>
					<td colspan="2" class="settingTitle">服务中心</td>
				</tr>
				<tr>
					<td colspan="2"><b>服务中心提成:</b><input type="text" name="ruleDTO.fuwuzhongxin1" value="${ruleDTO.fuwuzhongxin1 }" />%</th>
				</tr> --%>
				
				<tr>
					<td colspan="2"  class="settingTitle">提现</td>
				</tr>
				<tr>
					<td>提现手续费(24小时到账（周日不发放）)</td>
					<td><input type="text" name="ruleDTO.rule012" value="${ruleDTO.rule012 }" />%</td>
				</tr>
				<tr>
					<td>提现手续费</td>
					<td><input type="text" name="ruleDTO.rule013" value="${ruleDTO.rule013 }" />%</td>
				</tr>
				<tr>
					<td>提现提示</td>
					<td><textarea rows="2" style="width: 95%;" name="ruleDTO.rule010"  >${ruleDTO.rule010 }</textarea></td>
				</tr>
				
			    <tr>
					<td colspan="2"  class="settingTitle">自动匹配时间设置</td>
				</tr>
				<tr>
					<td colspan="2">
						自动匹配时间：<input type="text" name="ruleDTO.timeOut1" value="${ruleDTO.timeOut1 }" />秒<br>
						允许卖出股价：<input type="text" name="ruleDTO.allowSellPrice" value="${ruleDTO.allowSellPrice }" /><br>
						<%-- 基准股价：<input type="text" name="ruleDTO.timeOut3" value="${ruleDTO.timeOut3 }" /><br> --%>
					</td>
				</tr> 
				
			</table>
		</fieldset>
		<fieldset>
			<legend><h3>邮件设置</h3></legend>
			<table style="width: 100%;">
				<tr>
					<td>邮件姓名</td>
					<td><input type="text" name="ruleDTO.rule008" value="${ ruleDTO.rule008 }" /></td>
				</tr>
				<tr>
					<td>SMTP服务地址</td>
					<td><input type="text" name="ruleDTO.rule003" value="${ ruleDTO.rule003 }" /></td>
				</tr>
				<tr>
					<td>发送邮箱账号</td>
					<td><input type="text" name="ruleDTO.rule004" value="${ ruleDTO.rule004 }" /></td>
				</tr>
				<tr>
					<td>发送邮箱密码</td>
					<td><input type="password" name="ruleDTO.rule005" value="${ ruleDTO.rule005 }" /></td>
				</tr>
				<tr>
					<td>发出邮件标题</td>
					<td><input type="text"  style="width: 95%;" name="ruleDTO.rule006" value="${ ruleDTO.rule006 }" /></td>
				</tr>
				<tr>
					<td>发出邮件内容</td>
					<td><textarea style="height: 40px;width: 95%;" name="ruleDTO.rule007" >${ ruleDTO.rule007 }</textarea></td>
				</tr>
				<tr>
					<td>启用邮箱验证</td>
					<td><input type="checkbox" name="ruleDTO.rule022" value="true" <c:if test="${ ruleDTO.rule022 }">checked="checked"</c:if>  /></td>
				</tr>
				<tr>
					<td colspan="2"><input type="button" onclick="saveRule()" value=" 保存 " /></td>
				</tr>
			</table>
		</fieldset>
		
	
	</form>
</div>

</body>
</html>